<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
	<meta http-equiv="content-type" content="text/xml; charset=utf-8" /> 
    <title>Edit Tour</title>
    <meta name="description" content=""  /> 
	<meta name="keywords" content=""  /> 
	<link rel="stylesheet" type="text/css" href="formatstyles.css"/> 
	<link rel="stylesheet" type="text/css" href="divstyles.css"/> 
    <link rel="stylesheet" type="text/css" href="style/css/jquery-ui-1.8.18.custom.css" />
	
	<!-- include CSS always before including js -->

	<!-- include jQuery library -->
	<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
	<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="js/jquery.cycle.all.js"></script>
	<script type="text/javascript" src="js/scripts.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
	<script type="text/javascript" src="js/login.js"></script>
	<script type="text/javascript" src="js/comment.js"></script>
	<link rel="stylesheet" type="text/css" media="screen" href="style/css/demos.css"/>
	<style type="text/css" media="screen"> 
		@import "style/css/uni-form.css"; 
	</style>
	
	<!-- Demo page js -->
	<script type="text/javascript" src="js/jquery.uni-form.js"></script>
	
	<!-- Star Rating widget stuff here... -->
	<script type="text/javascript" src="js/jquery.ui.stars.js"></script>
	<link rel="stylesheet" type="text/css" href="style/css/crystal-stars.css"/>
	<link rel="stylesheet" type="text/css" href="style/css/jquery.ui.stars.css"/>
	<script type="text/javascript" src ="js/language-en.js"></script> 
	<script type="text/javascript" src ="js/nopcart.js" language="javascript"> 
	
      //============================================================== 
      //               NOP Design JavaScript Shopping Cart               
      //-------------------------------------------------------------- 
	  //       Visit NOP Design at http://www.nopdesign.com/freecart     
	  //============================================================== 
	</script> 
		
		<!-- Upload & Crop Image -->
		<link href="css/default.css" rel="stylesheet" type="text/css" />
		<link href="scripts/fileuploader/fileuploader.css" rel="stylesheet" type="text/css" />
		<link href="scripts/Jcrop/jquery.Jcrop.css" rel="stylesheet" type="text/css" />
		
		<script type="text/javascript" src="scripts/jquery-impromptu.js"></script>
		<script type="text/javascript" src="scripts/fileuploader/fileuploader.js"></script>
		<script type="text/javascript" src="scripts/Jcrop/jquery.Jcrop.min.js"></script>
		<script type="text/javascript" src="scripts/jquery-uberuploadcropper.js"></script>
		<script type="text/javascript" src="js/tupload.js"></script>
</head>

<body>
<div id="fade" style="display:none;"></div>
	<!-- This is the page section -->
	<div id="page_section">

		<!-- This is the banner --> 
		<div id="banner"> 
 			<?php include("banner.php"); ?>
		</div> 
		<!-- This is end of the banner --> 
    
    	<div id="user-cpanel">
		<?php include("user_cpanel.php"); ?>
		<?php include("session_admin.php"); ?>
        </div>
        <div class="wan-clear"></div>
        <div id="user-form">
       	<?php include("user-form.php"); ?>
		</div>
		<div id="topnav">
           <?php include("top-nav.php"); ?>
        </div>
		
		
		<div id="content">
            <?php
            
            if (isset($_SESSION['login'])==true &&( $_SESSION['login'])==true && ($_SESSION['username']=="inte")) {
            	echo '<div class="title-text">Edit Tour</div>';
                
                while($record = mysql_fetch_array($result)){
                    $tourName = $record['t_name'];
                    $duration = $record['duration'];
                    $price = $record['price'];
                    $description = $record['description'];
                    $destination = $record['destination'];
                    $regionID = $record['regionID'];
                    $image = $record['image'];
                    
					echo '<center><form id="edit_tour" method="post" action="update_tour.php">
                    		<table>
                            	<tr>
                                	<td><label for="tour_name">Tour Name</label> </td>
                                    <td><input size="50" name="tour_name" type="text" value="'.$tourName.'"/></td>
                                    <input type="hidden" name="tourID" value="'.$tourID.'"/>
                                </tr>
                                
                            	<tr>
                                	<td>Duration</td>
                                    <td><input size="50" type="text" name="duration" value="'.$duration.'"/></td>
                                </tr>
                                
                            	<tr>
                                	<td>Price</td>
                                    <td><input size="50" type="text" name="price" value="'.$price.'"/></td>
                                </tr>
                                
                            	<tr>
                                	<td valign="top">Description</td>
                                    <td><textarea name="description" rows="10" cols="39"/>'.$description.'</textarea></td>
                                </tr>
                                
                            	<tr>
                                	<td>Destination</td>
                                    <td><input name="destination" size="50" type="text" value="'.$destination.'"/></td>
                                </tr>
                                
                                <tr>
                                	<td valign="top">Occurance</td>
                                    <td align="left">';
                                        $data_arrs = array();
                                        $arrs = array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturnday','Sunday');                        					
                                        
                                        while ($occurance = mysql_fetch_array($occurance_result)) {
                                            array_push($data_arrs,$occurance['dayName']);
                                        }
                                        
                                        foreach($arrs as $val){
                                           $checked = in_array($val, $data_arrs) ? 'checked = "checked"' : '';
                                           echo '<input type="checkbox" name="dayName[]" value="'.$val.'" '.$checked.'/>'.$val.'<br />';
                                        }                                                                                        
                              echo '</td>
                                </tr>
                                
                                <tr>
									<td>Region</td>
                                    <td>
                          				<select name="region">';
                                            $arrs_region = array('1'=>'North Vietnam','2'=>'Middle Vietnam','3'=>'South Vietnam');
                                            foreach($arrs_region as $key => $val){
                                                if ($regionID == $key) {
	                                                echo '<option value="'.$key.'" selected >'.$val.'</option>';
                                                } else {
    	                                            echo '<option value="'.$key.'">'.$val.'</option>';
                                                }
                                            }
		                    	  echo '</select>
                                    </td>
								</tr>
                                
                                <tr valign="top">
                                	<td>Current Image</td>
                                    <td>
                                    	<img width ="300" height="200" src="'.$image.'"/>
                                    	<input type="hidden" value="'.$image.'" name="oldImg"/>
                                    </td>
                                    
                                    <td>
										<div id="UploadImages">
                            				<noscript>Please enable javascript to upload and crop images.</noscript>
                        				</div>
                                    </td>
                                    
                                    <td>
                                        <div id="PhotoPrevs">
                                            <!-- The cropped images will be populated here -->
                                        </div>                                    
                                    </td>
                                </tr>
                                
                                <tr>
                                	<td id="edit_submit" colspan="4" align="center">
										<input type="submit" value="Submit"/>
										<input type="reset" value="Reset"/>
                                    </td>
                                </tr>
                            </table>
					</form></center>';
				}
			} else {
            	include("notice.php");
            }
            ?>
		</div>
	
		<div class="wan-clear"></div>
		
<!-- This is end of the content -->
	</div> 
<!-- This is end of the page section -->
<br />
<!-- This is the footer -->
		<div id="footer"> 
			<p class="footer">This website is a student project that is intended to be used only for academic purposes. This page was created by Long, Tran Hoang </p>
		</div> 
<!-- This is end of the footer -->
</body>

</html>